package com.miracle.main.module.mvp.model;

import com.miracle.basemvp.base.BaseModel;
import com.miracle.basemvp.base.BaseResponse;
import com.miracle.basemvp.lifecycle.rx.RxSchedulersHelper;
import com.miracle.basemvp.network.IRetrofitManager;
import com.miracle.common.mvp.entity.response.BaseListResponse;
import com.miracle.main.module.api.MainApi;
import com.miracle.main.module.mvp.contract.SecretContract;
import com.miracle.main.module.mvp.entity.bean.FileItem;
import com.miracle.main.module.mvp.entity.bean.SecretBean;
import com.miracle.main.module.mvp.entity.request.SecretListRequest;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * com.miracle.main.module.mvp.model
 * (c)2018 AIR Times Inc. All rights reserved.
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/7/7 9:19
 * @see com.miracle.main.module.mvp.model
 */
public class SecretModel extends BaseModel implements SecretContract.Model {

    @Inject
    public SecretModel(IRetrofitManager retrofitManager) {
        super(retrofitManager);
    }

    @Override
    public Observable<BaseResponse<BaseListResponse<SecretBean>>> getList(SecretListRequest
                                                                                      request) {
        return mRetrofitManager
                .obtainRetrofitService(MainApi.class)
                .getSecrList(request)
                .compose(RxSchedulersHelper.<BaseResponse<BaseListResponse<SecretBean>>>io_main());
    }
}
